package com.laikan.reader.bookfriend.holder;

import android.net.Uri;
import android.view.View;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.laikan.reader.R;
import com.laikan.reader.bookfriend.entity.ItemAttentionBean;
import com.laikan.reader.bookfriend.mactivity.AutherActivity;
import com.laikan.reader.bookfriend.utils.Constant;
import com.laikan.reader.bookfriend.utils.ImageUtils;
import com.laikan.reader.core.LaikanApplication;
import com.laikan.reader.core.base.BaseHolder;

public class AttentionHolder extends BaseHolder {

    private TextView mTvTitle;
    private TextView mTvDes;
    private SimpleDraweeView mIvIcon;

    @Override
    public View initView() {
        View view = View.inflate(LaikanApplication.getContext(), R.layout.view_item_focus, null);
        mTvTitle = (TextView) view.findViewById(R.id.item_tv_title);
        mTvDes = (TextView) view.findViewById(R.id.item_tv_des);
        mIvIcon = (SimpleDraweeView) view.findViewById(R.id.item_iv_icon);
        return view;
    }

    @Override
    public void refreshView() {
        final ItemAttentionBean bean = (ItemAttentionBean) getData();


        mIvIcon.setImageURI(Uri.parse(bean.attentionPic));
        mTvDes.setText(bean.content);
        mTvTitle.setText(bean.attentionName);


        getRootView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //点击跳转到关注的人主页
                ImageUtils.startActivity(AutherActivity.class, Constant.USER_ID,bean.attentionId);
            }
        });
    }
}